﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

//可旋转的平台，不能是tilemap
public class Platform_Rotate : MonoBehaviour
{
    public float defaultRotateSpeed = 90f;
    
    public float rotateSpeed = 90f;

    private static Vector3 rotateAxis = new Vector3(0, 0, 1);

    private void FixedUpdate()
    {
        transform.RotateAround(transform.position, rotateAxis, rotateSpeed * Time.fixedDeltaTime);
    }

    public void StartRotate(bool clockwise)
    {
        rotateSpeed = clockwise ? defaultRotateSpeed : -defaultRotateSpeed;
    }

    public void StopRotate()
    {
        rotateSpeed = 0;
    }
}
